﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:prop="clr-namespace:Avalon.Properties">
    <LinearGradientBrush x:Key="Selected_LBI" EndPoint="0.494,0.889" StartPoint="0.494,0.028">
        <GradientStop Color="#99FFFFFF" Offset="0.05"/>
        <GradientStop Color="#33FFFFFF" Offset="0.5"/>
        <GradientStop Color="#33FFFFFF" Offset="1"/>
    </LinearGradientBrush>

    <LinearGradientBrush x:Key="MouseOver_LBI" EndPoint="0.494,0.889" StartPoint="0.494,0.028">
        <GradientStop Color="#33FFFFFF" Offset="0.5"/>
        <GradientStop Color="#33FFFFFF" Offset="1"/>
    </LinearGradientBrush>

    <XmlDataProvider x:Key="Top_Navigation_Data" XPath="Icons">
        <x:XData>
            <Icons xmlns="">
                <Icon Name="Email" LinkImage="pack://application:,,,/image/e_mail.png" value="收发邮件"/>
                <Icon Name="PackTrack" LinkImage="pack://application:,,,/image/e_mail.png" value="追踪包裹"/>
                <Icon Name="Commodity" LinkImage="pack://application:,,,/image/e_mail.png" value="收发邮件"/>
            </Icons>
        </x:XData>
    </XmlDataProvider>
    <DataTemplate x:Key="ItemTemplate">
        <StackPanel Orientation="Vertical">
            <Image Source="{Binding XPath=@LinkImage}" Width="70" Height="50"/>
            <TextBlock Text="{Binding XPath=@value}" Width="80" TextAlignment="Center" Foreground="White"/>
        </StackPanel>
    </DataTemplate>
    
    <Style x:Key="ListBox" TargetType="{x:Type ListBox}">
        <Setter Property="ItemTemplate"  Value="{DynamicResource ItemTemplate}" />
        <Setter Property="ItemContainerStyle"  Value="{DynamicResource ListBoxItem}" />
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ListBox}">
                    <Border Margin="0">
                        <StackPanel IsItemsHost="True" Orientation="Horizontal" Width="500" Height="75" Background="transparent" Margin="30,0,0,0"/>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style x:Key="ListBoxItem"  TargetType="{x:Type ListBoxItem}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ListBoxItem}">
                    <Grid>
                        <Rectangle x:Name="ListBG" Fill="{TemplateBinding Background}" RadiusX="5" RadiusY="5" Stroke="transparent" />
                        <Rectangle x:Name="GelShine" VerticalAlignment="top" RadiusX="5" RadiusY="5" Opacity="0" Stroke="transparent" Height="15px">
                            <Rectangle.Fill>
                                <LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
                                    <GradientBrush.GradientStops>
                                        <GradientStopCollection>
                                            <GradientStop Color="#ccffffff" Offset="0" />
                                            <GradientStop Color="transparent" Offset="1" />
                                        </GradientStopCollection>
                                    </GradientBrush.GradientStops>
                                </LinearGradientBrush>
                            </Rectangle.Fill>
                        </Rectangle>
                        <ContentPresenter x:Name="ContentSite" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                              VerticalAlignment="{TemplateBinding VerticalContentAlignment}" Margin="5"/>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsSelected" Value="True">
                            <Setter TargetName="ListBG" Property="Rectangle.Stroke" Value="transparent"/>
                            <Setter TargetName="GelShine" Property="Rectangle.Opacity" Value="0.8" />
                            <Setter Property="Background"  Value="{StaticResource Selected_LBI}" />
                            <Setter Property="FontWeight" Value="bold" />
                            <Setter Property="Foreground" Value="#FFF" />
                        </Trigger>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsSelected" Value="False" />
                                <Condition Property="IsMouseOver" Value="true" />
                            </MultiTrigger.Conditions>
                            <Setter TargetName="ListBG" Property="Rectangle.Stroke" Value="transparent"/>
                            <Setter TargetName="GelShine" Property="Rectangle.Opacity" Value="0.8" />
                            <Setter Property="Background"  Value="{StaticResource MouseOver_LBI}" />
                            <Setter Property="FontWeight" Value="bold" />
                            <Setter Property="Foreground" Value="#FFF" />
                        </MultiTrigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>    
</ResourceDictionary>